#pragma GCC optimize(2)
#pragma GCC optimize(3)

#include <bits/stdc++.h>

using namespace std;
typedef long long LL;
const int N = 1e7 + 3;
#define fi first
#define se second
#define pb push_back
#define wzh(x) cerr<<#x<<'='<<x<<endl;
int cnt[N];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int k;
    cin >> k;
    for (int i = 1; i <= k; i++) {
        int l, r;
        cin >> l >> r;
        cnt[l]++;
        cnt[r]--;
    }
    int ans = 0;
    for (int i = 1; i < N; i++)cnt[i] += cnt[i - 1], ans = max(ans, cnt[i]);
    cout << ans << '\n';
    return 0;
}
